package com.example.mybatisdemo.remoteapi.fallback;

import com.example.mybatisdemo.remoteapi.ThirdPartApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ThirdPartApiFallback implements FallbackFactory<ThirdPartApi> {
    @Override
    public ThirdPartApi create(Throwable cause) {
        log.error("远程调用失败",cause);

        return new ThirdPartApi() {
            @Override
            public String getProgress(String workOrderNo) {
                return "失败";
            }
        };
    }
}
